// pages/issusInvoice/issusInvoice.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    count:[0,0,0],
    countText:['','','']
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    if (options.c1!=undefined){
      var c1 = options.c1;
      var c2 = options.c2;
      var c3 =options.c3;
      that.data.countText[0] = c1;
      that.data.countText[1] = c2;
      that.data.countText[2] = c3;
      //获取手机高度
      that.setData({
        navH: app.globalData.navHeight,
        c1:c1,
        c2: c2,
        c3: c3,
        countText:that.data.countText
      });
    }else{
      //获取手机高度
      that.setData({
        navH: app.globalData.navHeight,
      });
    }
    
   
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  getText:function(e){
    var that = this;
    var index = parseInt(e.target.dataset.index);
    let value = e.detail.value;
    let len = parseInt(value.length);
    var countList = that.data.count;
    var countTextList = that.data.countText;
    countList[index] = len;
    countTextList[index] = value;
    that.setData({
      count: countList,
      countText:countTextList
    })
  },

  navBack: function () {
    var that = this;
    var pages = getCurrentPages();
    var prevPage = pages[pages.length - 2]; //上一个页面
    //直接调用上一个页面的setData()方法，把数据存到上一个页面中去
    prevPage.setData({
      countTextList: that.data.countText
    })
    wx.navigateBack({//返回
      delta: 1
    })
  },
})